<link rel="stylesheet" type="text/css" href="<?php echo COMPONENT_PATH."css/datepicker.css"; ?>" />
<form method="post" action="" name="new_booking_form">
<table border="0" width="100%">
	<tr class="HeaderTr">
		<td colspan="2"><b>Select A Unit</b></td>
	</tr>
	<tr>
		<td><label for="unit">Select A Unit</label></td>
		<td>
		<select name="booking[uid]" id="unit">
				<option value="">Select a unit</option>
				<?php foreach($units as $unit){ ?>
					<option value="<?php echo $unit->id;?>"><?php echo $unit->address;?></option>
				<?php }?>
		</select>
		</td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr class="HeaderTr">
		<td colspan="2"><b>Select Dates</b></td>
	</tr>
	<tr>
		<td><label for="arr_date">Arrival Date:</label> <input name="booking[startdate]" id="arr_date" class="date_pick" /></td>
		<td><label for="dep_date">Departure Date:</label> <input name="booking[enddate]" id="dep_date" class="date_pick" /></td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr class="HeaderTr">
		<td colspan="2"><b>Guest Information</b></td>
	</tr>
	<tr>
		<td colspan="2">
			<table>
				<tr>
					<td><label for="title">Title</label></td>
					<td>
					<select name="customer[title]" id="title" size="1">
					<option value="Mr">Mr</option>
					<option value="Mrs">Mrs</option>
					<option value="Miss">Miss</option>
					<option value="Ms">Ms</option>
					</select>
					</td>
				</tr>
				<tr>
					<td><label for="first_name">First Name</label></td>
					<td><input type="text" name="customer[firstname]" id="first_name" /></td>
				</tr>
				<tr>
					<td><label for="surname">Surname</label></td>
					<td><input type="text" name="customer[surname]" id="surname" /></td>
				</tr>
				<tr>
					<td><label for="addr">Address</label></td>
					<td><input type="text" name="customer[address1]" id="addr" size="50" /></td>
				</tr>
				<tr>
					<td><label for="other_addr">Other Address</label></td>
					<td><input type="text" name="customer[address2]" id="other_addr" size="50" /></td>
				</tr>
				<tr>
					<td><label for="city">City</label></td>
					<td><input type="text" name="customer[city]" id="city" /></td>
				</tr>
				<tr>
					<td><label for="post_code">Postcode</label></td>
					<td><input type="text" name="customer[postcode]" id="post_code" /></td>
				</tr>
				<tr>
					<td><label for="state">State</label></td>
					<td><input type="text" name="customer[state]" id="state" /></td>
				</tr>
				<tr>
					<td><label for="country">Country</label></td>
					<td><input type="text" name="customer[country]" id="country" /></td>
				</tr>
				<tr>
					<td><label for="telephone">Telephone</label></td>
					<td><input type="text" name="customer[telephone]" id="telephone" /></td>
				</tr>
				<tr>
					<td><label for="email">Email</label></td>
					<td><input type="text" name="customer[email]" id="email" /></td>
				</tr>
				<tr>
					<td><label for="notes">Notes</label></td>
					<td><textarea cols="50" name="customer[notes]" id="notes"></textarea></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<input type="hidden" name="form" value="new_booking" />
</form>
<?php $KToolBar->addLink('<a href="#" onclick="document.new_booking_form.submit()"><img border="0" alt="Save" src="images/save_f2.png"/><br />Save</a>');?>
<?php $KToolBar->addLink('<a href="?option='.COMPONENT_NAME.'&page=bookings"><img border="0" alt="Cancel" src="images/cancel_f2.png"/><br />Cancel</a>');?>

<script type="text/javascript" src="<?php echo COMPONENT_PATH."js/date.js"; ?>" charset="ISO-8859-1"></script>
<script type="text/javascript" src="<?php echo COMPONENT_PATH."js/jquery.datePicker.js"; ?>" charset="ISO-8859-1"></script>
<script type="text/javascript">
Date.firstDayOfWeek = 0;
Date.format = 'mm/dd/yyyy';
$(function()
{
	$('.date_pick').datePicker();
	$('#arr_date').bind(
		'dpClosed',
		function(e, selectedDates)
		{
			var d = selectedDates[0];
			if (d) {
				d = new Date(d);
				$('#dep_date').dpSetStartDate(d.addDays(1).asString());
			}
		}
	);
	$('#dep_date').bind(
		'dpClosed',
		function(e, selectedDates)
		{
			var d = selectedDates[0];
			if (d) {
				d = new Date(d);
				$('#arr_date').dpSetEndDate(d.addDays(-1).asString());
			}
		}
	);
});
</script>
